<?php

namespace app\api\controller;

use think\response\Json;

class Exam extends Base
{
    public function getList(): Json
    {
        $list = app(\app\api\logic\Exam::class)->getList();
        return $this->response($list);
    }
    
    /**
     * 查询考试类型的专业和课程
     * @return Json
     */
    public function getTypeMajor(): Json
    {
        // 请求参数
        $param = $this->request->param();

        // 检查参数
        if (empty($param['exam_id'])) {
            return $this->response([], 400, '考试ID不能为空');
        }
        
        // 查询数据
        $data = app(\app\api\logic\Exam::class)->getTypeMajor($param);
        return $this->response($data);
    }
}